package com.wicket.okrapp.common.enums;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.List;

/**
 * @author CHS
 * @version 1.0.0
 * TODO
 * @createTime 2022年04月07日 09:58:00
 */
@Getter
public enum ImageEnums {

    ROLE_ICON("ROLE_ICON", "角色图标", Lists.newArrayList(new Size("_104", 104, 104))),

    POWER_ICON("POWER_ICON", "权限图标", Lists.newArrayList(new Size("_104", 104, 104))),

    APP_BANNER("APP_BANNER", "应用banner", Lists.newArrayList(new Size("_550", 550, 1024))),

    APP_FRAME_LOGO("APP_FRAME_LOGO", "应用框架logo", Lists.newArrayList(new Size("_104", 104, 104))),

    USER_HEAD("USER_HEAD", "用户头像", Lists.newArrayList(new Size("_20", 20, 20),
            new Size("_32", 32, 32), new Size("_40", 40, 40),
            new Size("_48", 48, 48), new Size("_80", 80, 80))),

    SPACE_HEAD("SPACE_HEAD", "空间头像", Lists.newArrayList(new Size("_96", 96, 96))),

    SCENE_LOGO("SCENE_LOGO", "场景logo", null),

    ABOUT_US_LOGO("ABOUT_US_LOGO", "关于我们logo", null);

    private String code;
    private String display;
    private List<Size> sizes;

    ImageEnums(String code, String display, List<Size> sizes) {
        this.code = code;
        this.display = display;
        this.sizes = sizes;
    }

    public static ImageEnums getEnumByCode(String code) {
        for (ImageEnums enums : ImageEnums.values()) {
            if (enums.code.equals(code)) {
                return enums;
            }
        }
        return null;
    }


    @Data
    @AllArgsConstructor
    public static class Size {

        private String suffix;

        private int high;

        private int width;
    }
}
